<template>
	<view>
		<view class="body">
			<uni-forms :value="formData" ref="form" :rules="rules">
				<uni-group title="影响家庭经济状况有关信息">
					<uni-forms-item name="incomeType" required label="家庭主要收入来源(只能勾选其中一项)" labelWidth="250"
						labelAlign="right" labelPosition="top">
						<uni-data-checkbox mode="list" v-model="formData.incomeType" :localdata="incomeType" />
					</uni-forms-item>
				</uni-group>
				
				<uni-group title="" margin-top="">
					<uni-forms-item label="学生已获资助情况"  name="support" labelWidth="200" labelPosition="top">
						<uni-easyinput v-model="formData.support" type="textarea" placeholder="时间、受资助的具体项目、受助金额人民币元"></uni-easyinput>
					</uni-forms-item>
				</uni-group>

				<uni-group title="其他情况影响家庭收入来源(两年内)">
					
					<uni-forms-item label="家庭遭受自然灾害情况" name="disaster" labelWidth="200" labelPosition="top">
						<text style="color: #F43559;">该项需提供相应的电视报道截图或县级以上证明</text>
						<!-- <picker mode="date">
							<view style="margin-bottom: 5px;">
								<uni-easyinput  disabled suffixIcon="arrowdown" value="请选择发生时间"></uni-easyinput>
							</view>
						</picker> -->
						<uni-easyinput v-model="formData.disaster" type="textarea" placeholder="填写发生时间和最近两年内发生、损失金额、人员伤亡等具体描述"></uni-easyinput>
					</uni-forms-item>
					
					<uni-forms-item label="家庭遭受突发意外事件" name="accident" labelWidth="200" labelPosition="top">
						<!-- <picker mode="date">
							<view style="margin-bottom: 5px;">
								<uni-easyinput  disabled suffixIcon="arrowdown" value="请选择发生时间"></uni-easyinput>
							</view>
						</picker> -->
						<uni-easyinput v-model="formData.accident" type="textarea" placeholder="填写发生时间和最近两年内发生、损失金额、人员伤亡等具体描述"></uni-easyinput>
					</uni-forms-item>
					
					<uni-forms-item label="家庭欠债情况" name="debt" labelWidth="200" labelPosition="top">
						
						<!-- <picker mode="date">
							<view style="margin-bottom: 5px;">
								<uni-easyinput  disabled suffixIcon="arrowdown" value="请选择发生时间"></uni-easyinput>
							</view>
						</picker> -->
						<uni-easyinput v-model="formData.debt" style="margin-bottom: 5px;" type="textarea" placeholder="欠债原因"></uni-easyinput>
						
					</uni-forms-item>
					
					<uni-forms-item label="欠债金额(单位:元)" name="amount" labelPosition="top" labelWidth="200">
						<uni-easyinput type="number" v-model="formData.amount"  placeholder="欠债金额"></uni-easyinput>
					</uni-forms-item>
					
					


					<uni-forms-item label="其他情况" name="Other" labelWidth="200" labelPosition="top">
						<uni-easyinput v-model="formData.Other" type="textarea" placeholder="时间·人员等"></uni-easyinput>
					</uni-forms-item>
				</uni-group>

				<uni-group>
					<button @click="submit" type="primary">下一页(4/5)</button>
				</uni-group>

			</uni-forms>
		</view>
		<uni-popup ref="popup"></uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				time:'',
				formData: {
					incomeType: '',
					support:'',
					disaster:'',
					accident:'',
					debt:'',
					amount:'',
					Other:'',
					
					
					
				},
				incomeType: [{
					text: '工资、奖金、津贴和其他劳动收入',
					value: 0
				}, {
					text: '离退休金、基本养老金、基本生活费、失业保险金',
					value: 1
				}, {
					text: '继承、接受赠予、出租或出售家庭财产获得的收入',
					value: 2
				}, {
					text: '存款及利息，有价证券及红利，股票等收入',
					value: 3
				}, {
					text: '经商、办厂以及从事种植业、养殖业、加工业扣除必要成本后的收入',
					value: 4
				}, {
					text: '赡养费、抚(扶)养费',
					value: 5
				}, {
					text: '自谋职业收入',
					value: 6
				}, {
					text: '其他应当计入家庭收入',
					value: 7
				}],
				sudden: [{
					text: '家庭遭受自然灾害',
					value: 0
				}, {
					text: '家庭突发意外事件',
					value: 1
				}, {
					text: '家庭欠债',
					value: 2
				}],
				rules: {
					incomeType:{
						rules:[{
							required:true,
							errorMessage:'请选择家庭收入来源其中一项'
						}]
					}
				}
			}
		},
		onLoad:function(){
			uni.showLoading({
				title: '加载中'
			})
			uni.getStorage({
				key: 'kunnan_info',
				success: (res) => {
					getApp().globalData.kunnan = res.data
					if(res.data.incomeType != undefined){
						// console.log('nnnn')
						
						this.formData =  res.data.incomeType
						
					}
					
					setTimeout(function() {
						uni.hideLoading();
					}, 300);
				},
				fail: () => {
					setTimeout(function() {
						uni.hideLoading();
					}, 300);
				}
			})
		},
		methods: {
			submit() {
				this.$refs.form.submit().then(res => {
					console.log('表单数据信息：', res);
					getApp().globalData.kunnan.incomeType = res
					uni.setStorage({
						key:'kunnan_info',
						data:getApp().globalData.kunnan
						
					})
					uni.navigateTo({
						url:'autograph'
					})
				}).catch(err => {
					uni.showToast({
						icon:'none',
						title:'未填写完毕'
					})
					console.log('表单错误信息：', err);
				})
				
			},
			Emergency_time(e){
				this.formData.Emergency_time = e.detail.value
			}
		}
	}
</script>

<style>

</style>
